import { gatewayBaseUrl, runtimeConfig } from '~/utils/commonData'

// 引入
import httpRequest from '../server/index'

// import { get, post } from '~/server/request'
// console.log(process.env.NUXT_PUBLIC_API_BASE)

/**
 * @description 请求列表接口
 * @returns 列表数据
 */
const getListData = (params: unknown) => {
  return get('http://121.36.81.61:8000/getTenArticleList', params)
}

/**
 * 只在客户端侧发起请求
 * @description 修改数据
 * @param {any} data
 * @returns {any}
 */
const editListData = (data: unknown) => {
  return httpRequest.post('/product/mall/recommend', data, { server: false },
  )
}
const getUserInfo = (params: unknown) => {
  return get('/user-center/user/getLoginInfo', params, { server: false })
}
// 附件上传链接
const sourcingCustomization = () => {
  const baseUrl = gatewayBaseUrl(runtimeConfig())
  return `${baseUrl}/api/user-center/abroadCompany/fileUpload`
}
// 获取公司信息
const getCompanyInfo = (data: unknown) => {
  const baseURL = gatewayBaseUrl(runtimeConfig())
  return httpRequest.post(`/api/user-center/abroadCompany/queryDetail`, data, {
    server: false,
    baseURL,
  })
//   return httpRequest.post('/user-center/abroadCompany/queryDetail', params, { server: false })
}

const getBasicInfo = (data: unknown) => {
  const baseURL = gatewayBaseUrl(runtimeConfig())
  return httpRequest.get(`/api/user-center/abroadCompany/queryBasicByCompanyType`, data, {
    server: false,
    baseURL,
  })
}

// 是否注册过
const getIsSubmit = (data: unknown) => {
  const baseURL = gatewayBaseUrl(runtimeConfig())
  return httpRequest.get(`/api/user-center/abroadCompany/isSubmit`, data, {
    server: false,
    baseURL,
  })
}

export { editListData, getBasicInfo, getCompanyInfo, getIsSubmit, getListData, getUserInfo, sourcingCustomization }
